<template>
<div id="movie">
  <h1>获取名字长度在4-6字电影列表</h1>
  <ul>
    <li v-for="movie in getMyMovieList" :key="movie.tvid" v-show="flag">{{movie.albumName}}</li>
  </ul>
  <div class="line"></div>
  <h1>获取你想要电影名字长度</h1>
  <button @click="changeLength">更改电影名长度</button>
  <ul>
    <li v-for="movie in getYourMovieList" :key="movie.tvid" v-show="flag">{{movie.albumName}}</li>
  </ul>
</div>
</template>

<script>

export default {
  name: "Movie",
  components: {

  },
  data(){
    return{
      flag: true,
      starts:1,
      ends:100
    }
  },
  computed:{
    getMyMovieList(){
      return this.$store.getters.getMyMovieList
    },
    getYourMovieList() {
      return this.$store.getters.getYourMovieList({start:this.starts,end:this.ends})
    }
  },
  methods:{
    changeLength(){
      this.starts = parseInt(prompt('请输出起始长度:'))
      this.ends = parseInt(prompt('请输出结束长度:'))
    }
  }
}
</script>

<style scoped>
#movie{
  margin: 20px auto;
  width: 800px;
  background-color: #31b0d5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.line{
  width: 100%;
  height: 3px;
  margin: 20px 0;
  background-color: yellow;
}
</style>